import request from '@/utils/request'

/**
 * 获取所有权限点
 * @returns
 */
export function getAllPermissions() {
  return request({
    url: '/sys/permission'
  })
}
/**
 * 添加权限点
 * @param {*} data
 * @returns
 */
export function addPermissions(data) {
  return request({
    method: 'post',
    url: '/sys/permission',
    data
  })
}

// 更新权限
export function updatePermission(data) {
  return request({
    method: 'put',
    url: `/sys/permission/${data.id}`,
    data
  })
}

// 删除权限
export function delPermission(id) {
  return request({
    method: 'delete',
    url: `/sys/permission/${id}`
  })
}
// 获取权限详情
export function getPermissionDetail(id) {
  return request({
    method: 'get',
    url: `/sys/permission/${id}`
  })
}
/**
 * 给角色分配权限
 * @param {*} data
 * @returns
 */
export function assignPrem(data) {
  return request({
    method: 'PUT',
    url: '/sys/role/assignPrem',
    data
  })
}
